package com.ktjy.aop;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Random;

public class LogAspect {
    Logger logger= LoggerFactory.getLogger(LogAspect.class);

    public void l1(){
        logger.info("打印机开始自检");
        //产生随机数
        Random random=new Random();
        int num=random.nextInt(10);
        if(num<5){
            logger.info("检查正常");
        }else{
            throw new RuntimeException("检查异常");
        }
    }

    public void l2(){
        logger.info("打印成功");
    }

    public void l3(Throwable abc){
        logger.info("异常原因："+abc.getMessage());
    }
}
